package components.banners
{
	import UIFree.controls.uif_close;
	import UIFree.controls.uif_leavesBlock;
	import UIFree.uif_Timer;
	import UIFree.uif_component;
	
	import flash.display.Loader;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.system.LoaderContext;

	public class clt_adInvestSystem extends uif_leavesBlock {
		private var _loader: Loader;
		public function clt_adInvestSystem(parent:uif_component) {
			
			super(parent, 0, (parent.height - 400) / 2, 250, 410);
			
//			Security.loadPolicyFile();
			
			var link: String = 'http://invest-system.net/banners/invest_240x400.swf?isLink=http://invest-system.net/partner/47603';
			_loader = new Loader();
			_loader.load(new URLRequest(encodeURI(link)), new LoaderContext(true));
			_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, doComplete);
		}
		
		protected function doComplete(e: Event): void {
			new uif_Timer(12000, null, function(e: Event): void {
				_loader.y = 10; 
				block.addChild(_loader);
				show();
				new uif_close(block, block.width - 21, 2);
			}, 1);
			block.addEvent(Event.CLOSE, function(e: Event): void {
				hide(function(): void {
					dispose();
				});
			});
		}
	}
}